[improve][client] PIP-224: Add getLastMessageIds API to deprecate getLastMessageId #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Master Issue: apache#18616
Fixes apache#4940
NOTE: This implementation is different from the original design of PIP-224 that the method name is
getLastMessageIds
instead ofgetLastTopicMessageId
.Motivation
When a multi-topics consumer calls
getLastMessageId
, aMultiMessageIdImpl
instance will be returned. It contains a map of the topic name and the latest message id of the topic. However, theMultiMessageIdImpl
cannot be used in any place of the API that accepts aMessageId
because all methods of theMessageId
interface are not implemented, includingcompareTo
andtoByteArray
.Therefore, users cannot do anything on such a
MessageId
implementation except castingMessageId
toMultiMessageIdImpl
and get the internal map.Modifications
getLastMessageId
on a multi-topics consumer instead of returning aMultiMessageIdImpl
.MultiMessageIdImpl
implementation and its related tests.getLastMessageIds
methods toConsumer
. It returns a list ofTopicMessageId
instances, each of them represents the last message id of the owner topic.getLastMessageId
API as deprecated.Verifications
TopicsConsumerImplTest#testGetLastMessageId
to test thegetLastMessageIds
for a multi-topics consumer.TopicReaderTest#testHasMessageAvailable
to test thegetLastMessageIds
for a single topic consumer.